package cn.regexp.mybatisinterceptordemo.mapper;

import cn.regexp.mybatisinterceptordemo.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

    @Insert("INSERT INTO test.`user` (name, age) VALUES(#{name}, #{age})")
    void insert(User user);

    @Update("UPDATE test.`user` SET name=#{name}, age=#{age} WHERE id=#{id}")
    void update(User user);

    @Delete("DELETE FROM test.`user` WHERE id=#{id}")
    void delete(Long id);

    @Select("SELECT id, name, age FROM test.`user` WHERE age=#{age}")
    List<User> select(Integer age);
}
